<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title></title>
	<link rel="stylesheet" href="">
</head>
<body>
	<input type="text" id= "username">姓名
	<input type="text" id= "age">年龄
	<button>提交</button>
	<script type= "text/javascript">
		
		var btn = document.querySelector('button');
		var username = document.getElementById('username')
		var age = document.getElementById('age')
		btn.onclick = function() {
			var nameValue = username.value;
			var ageValue = age.value;
			var params = 'username='+nameValue+ '&age='+ageValue;
			var xhr = new XMLHttpRequest();
			xhr.open('get','http://localhost:3000/get?'+params);
			xhr.send();
			xhr.onload = function() {
					console.log(xhr.responseText)
			}
		}
	</script>
</body>
</html>